﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace EAGL.Explore
{
    internal static class ObjectArrayComparer
    {
        /// <summary>
        /// Compares if Two object arrays are equal to each other
        /// </summary>
        /// <param name="a1"></param>
        /// <param name="a2"></param>
        /// <returns></returns>
        public static bool IsEqual(object[] a1, object[] a2)
        {
            bool v = true;
            int i = 0;
            int c = a1.Length;
            while (v && i < c)
            {
                v = v && (a1[i].Equals(a2[i]));
                i++;
            }


            return v;
        }

        
        /// <summary>
        /// Checks if one object array is within a list of object arrays
        /// </summary>
        /// <param name="vals"></param>
        /// <param name="list"></param>
        /// <returns></returns>
        public static bool IsIn(object[] vals, List<object[]> list)
        {
            bool v = false;
            int i = 0;
            int c = list.Count;

            while (!v && i < c)
            {
                v = IsEqual(list[i], vals);
                i++;
            }

            return v;
        }
    }
}
